<template>
  <div class="member-order-detail" v-if="order" >
    <!-- 头部 -->
    <DetailAction :order="order" @getDetailOrder="getDetailOrder"/>
    <!-- 进度 -->
    <DetailStep :order="order"></DetailStep>
    <!-- 物流 -->
    <Suspense >
      <template #default>
        <DetailLogistics v-if="[3, 4, 5].includes(order.orderState)" :order="order"></DetailLogistics>
      </template>
      <template #fallback>
          <div style="margin:auto"> 加载中</div>
      </template>
    </Suspense>
    <!-- 信息 -->
    <DetailInfo :order="order"/>
  </div>
</template>

<script setup>
import { findOrder } from '@/api/order';
import { onMounted, ref } from 'vue';
import { useRoute } from 'vue-router';
import DetailAction from './components/detail-action'
import DetailStep from './components/detail-step'
import DetailLogistics from './components/detail-logistics'
import DetailInfo from './components/detail-info'
const order = ref(null)
const route = useRoute()
  onMounted( ()=>{
    getDetailOrder()
  })
  const getDetailOrder = async () => {
    const res = await findOrder(route.params.id)
    order.value = res.result
  }
</script>

<style lang="scss" scoped>
.member-order-detail {
  background: #fff;
  height: 100%;
}
</style>